package org.example.ipersistent.sqlSession;

import org.dom4j.DocumentException;
import org.example.ipersistent.pojo.Configuration;
import org.example.ipersistent.utils.XmlConfigBuilder;

import java.io.InputStream;

public class SqlSessionFactoryBuilder {
  public SqlSessionFactory build(InputStream inputStream) throws DocumentException {
    // 解析配置文件，封装容器对象
    XmlConfigBuilder builder = new XmlConfigBuilder();
    Configuration configuration = builder.parse(inputStream);
    return new DefaultSqlSessionFactory(configuration);
  }
}
